import 'package:flutter/material.dart';
import 'package:hi_flutter/im/common/touch_callback.dart';

class ImItem extends StatelessWidget {


  final String title;
  final String imagePath;
  final Icon? icon;

  const ImItem({super.key, required this.title, required this.imagePath, this.icon});

  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return TouchCallBack(
      child: SizedBox(
        height: 50.0,
        child: Row(
          children: <Widget>[
            Container(
              margin: const EdgeInsets.only(left: 22.0, right: 22.0),
              child: imagePath != null
                ? Image.asset(imagePath, width: 32.0, height: 32.0)
                : SizedBox(width: 32.0, height: 32.0, child: icon),
            ),
            Text(title, style: const TextStyle(fontSize: 16.0, color: Color(0xff353535)))
          ],
        ),
      ),
      onPressed: () {
        switch(title) {
          case '好友动态':
            Navigator.pushNamed(context, 'friends');
            break;
          case '联系客服':
            break;
        }
      }
    );
  }

}

